home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr35 / dispwhen.zip / DISPWHEN.PPS < prev    next >
Text File  |  1993-04-03  |  3KB  |  102 lines

  1. ; *****************************************************************
  2. ; *                                                               *
  3. ; *                       DISPWHEN V 1 . 0                        *
  4. ; *                                                               *
  5. ; *                    Written in PPL for PCBoard                 *
  6. ; *                                                               *
  7. ; *                    Designed By:  Gary Meeker                  *
  8. ; *                                                               *
  9. ; *                    Began development: 04-03-93                *
  10. ; *                                                               *
  11. ; *****************************************************************
  12. ;
  13. ; This .PPE checks day, time & security level and displays a file if applicable.
  14. ; Usage:
  15. ;
  16. ; !DispWhen.PPE LowSec;HighSec;StartTime;EndTime;Days;DisplayFile
  17. ;
  18. ; Where:
  19. ;      LowSec is the lowest level to display the file to
  20. ;     HighSec is the highest level to display the file to
  21. ;   StartTime is the Earliest time to display the file
  22. ;     EndTime is the latest time to display the file
  23. ;        Days is the day flags to display the file SMTWTFS (Y or N for each)
  24. ; DisplayFile is the file to be displayed
  25. ;
  26. ; Example:
  27. ;
  28. ; !DispWhen.PPE 10;80;06:00;08:00;NYYYYYN;C:\PCB\GEN\NoWay
  29. ;
  30. ; The file C:\PCB\GEN\NoWay will be displayed to any caller with a security
  31. ; level between 10 and 80 (inclusive) between the hours 6am to 8am on a
  32. ; weekday (M-F).
  33. ;
  34. ; DispWhen will properly Handle time ranges where the EndTime falls before the
  35. ;   StartTime.  ie.
  36. ;
  37. ; !DispWhen.PPE 10;80;23:00;01:00;;C:\PCB\GEN\NoWay
  38. ;
  39. ; Also, Days maybe left blank (as above example) and YYYYYYY will be assumed.
  40. ;   (Y will be assumed for any days not specified ie NN becomes NNYYYYY)
  41. ;
  42.  
  43. STRING StartTimeSt, EndTimeSt, DaySt, DisplayFile
  44. INTEGER SecLow, SecHigh
  45. TIME StartTime, EndTime, CurrentTime
  46.  
  47. ;Parse the command line
  48.  
  49. GETTOKEN SecLow
  50. GETTOKEN SecHigh
  51. GETTOKEN StartTimeSt
  52. GETTOKEN EndTimeSt
  53. GETTOKEN DaySt
  54. GETTOKEN DisplayFile
  55.  
  56. ; If time is in HH:MM format Adjust the string to HH:MM:SS or they
  57. ;   won't convert
  58.  
  59. IF (LEN(StartTimeSt)=5) LET StartTimeSt = StartTimeSt + ":00"
  60. IF (LEN(EndTimeSt)=5) LET EndTimeSt = EndTimeSt + ":00"
  61.  
  62. ; Convert from STRING to TIME for comparisons
  63.  
  64. StartTime   = StartTimeSt
  65. EndTime     = EndTimeSt
  66.  
  67. ;Make sure all 7 Days are accounted for assuming Y for a short string
  68.  
  69. DaySt = LEFT(DaySt + "YYYYYYY", 7)
  70.  
  71. ; Load the User info so we can get to U_SEC
  72.  
  73. GETUSER
  74.  
  75. ; Get the current time
  76.  
  77. CurrentTime = TIME()
  78.  
  79. ; Check the security level range - bail out if not in the desired range
  80.  
  81. IF (U_Sec < SecLow | U_Sec > SecHigh) STOP
  82.  
  83. ; Check the current day of the week and if flag says N then bail out
  84. ;   DOW(DATE()) returns 0-6 for Sunday-Saturday so add 1 for MID()
  85.  
  86. IF (UPPER(MID(DaySt, DOW(DATE()) + 1, 1))= "N") STOP
  87.  
  88. ; See if Start time is before end time... ie. range specified as 23:00;01:00
  89. ;  If not then Current Time must be within range
  90. ;  If so then Current Time must appear to be outside of range
  91.  
  92. IF (StartTime <= EndTime) THEN
  93.    IF (CurrentTime < StartTime | CurrentTime > EndTime) STOP
  94. ELSE
  95.    IF (CurrentTime < StartTime & CurrentTime > EndTime) STOP
  96. END IF
  97.  
  98. ; We passed all the criteria, show the file (allow for all types)
  99.  
  100. DISPFILE DisplayFile, LANG+SEC+GRAPH
  101. END
  102.